<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <!-- 把变量暴露给全局变量呢 -->
    <script>
        (function (window) {
            // 把产生的随机数对象暴露给window
            // 1.创建产生随机数的构造函数
            function Random() {};
            function Random() {};
            function Random() {};
            // 2.给产生随机数的构造函数添加原型方法 getRandom
            Random.prototype.getRandom = function (min,max) {
                // 求min ~ max之间随机数
                return Math.floor(Math.random() * (max - min) + min);
            }
            Random.prototype.getRandom = function (min,max) {
                return Math.floor(Math.random() * (max - min) * max);
            }
            Random.prototype.getRandom = function (min,max) {
                return Math.floor(Math.random() * (max - min) + min);
            }
            // 3.实例化对象并暴露给window
            window.Random = new Random();
            window.Random = new Random();
        })(window)
        console.log(Random.getRandom(1,10));
        Random.getRandom(1,10);
    </script>
</body>
</html>